<template>
  <el-pagination ref="compRef" v-model="value" v-bind="{ ...$props }">
    <template v-for="(_slot, slotName) in $slots" #[slotName]="slotProps">
      <slot :name="slotName" v-bind="slotProps" :key="slotName"></slot>
    </template>
  </el-pagination>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { PaginationProps } from "element-plus";
import { BasePaginationExpose } from "./types";
interface Props extends Partial<PaginationProps> {}

/** 需要按照官网文档设置默认值，否则表现效果和官网文档的不一致 */
withDefaults(defineProps<Props>(), {
  size: "default",
  pagerCount: 7,
  layout: "prev, pager, next, jumper, ->, total",
  pageSizes: () => [10, 20, 30, 40, 50, 100],
  teleported: true,
});

const value = defineModel();
const compRef = ref();

defineExpose<BasePaginationExpose>({
  // @ts-ignore
  instance: compRef,
});
</script>
<style lang="scss"></style>
